<?php

class Jd_pay_model extends MY_Model {

    public function __construct()
    {
        $this->modelename='Jd_pay_model';
        $this->tablename='pay';
        parent::__construct();
    }





    public function  addpay($array=array()){
        $array['user_id']=$this->userId;
        $array['addtime']=time();
      return  $r= $this->add($this->tablename,$array);

    }


    /**
     * 通过充值
     * @param $id
     * @return bool
     */
    public function approvepay($id){
       $result= $this->getonebyid($id);
       if($result['status']!=0){
           return false;
       }
       $r= $this->update($this->tablename,"id",$id,array('status'=>1));
       if($r){
           return $result;
       }else{
           return false;
       }
    }

    public function PayRefuse($id,$remark){
        $result= $this->getonebyid($id);
        if($result['status']!=0){
            return false;
        }
        return  $r= $this->update($this->tablename,"id",$id,array('status'=>2,'remark'=>$remark));
    }





}
